#!/bin/bash


awk -v offset=$offset '{ 

    start = substr($0, 1, index($0, "}{")); 
    page = substr($0, index($0, "}{") + 2, length($0) - index($0, "}{") - 2); 

    print start "{" (page + offset) "}"; 

}' < thesis.idx > temp.thesis.idx
mv temp.thesis.idx thesis.idx



makeindex thesis.idx
